var app = angular.module('myapp');
app.controller('index.ctrl', ['$scope', '$http', '$state', function ($scope, $http, $state) {
    $scope.currentPage=1;
    $scope.goPrev=function () {
        if ($scope.currentPage==1){
            $scope.currentPage=1
        }else{
            $scope.currentPage-=1;
        }
        $http({
            url:'/product/getproducts',
            method:'get',
            params:{currentPage:$scope.currentPage}
        }).then(function (res) {
            for(var i=0;i<res.data.data.length;i++){
                var imgString=res.data.data[i].productImg;
                var imgarray=imgString.split(',');
                res.data.data[i].productImg=imgarray;
            }
            $scope.productList=res.data.data;
        });
    };
    $scope.goNext=function () {
        if ($scope.currentPage==$scope.totalPage){
            $scope.currentPage=$scope.totalPage
        }else{
            $scope.currentPage+=1;
        }
        $http({
            url:'/product/getproducts',
            method:'get',
            params:{currentPage:$scope.currentPage}
        }).then(function (res) {
            for(var i=0;i<res.data.data.length;i++){
                var imgString=res.data.data[i].productImg;
                var imgarray=imgString.split(',');
                res.data.data[i].productImg=imgarray;
            }
            $scope.productList=res.data.data;
        });
    };
    $http({
        url:'/product/getproducts',
        method:'get',
        params:{currentPage:$scope.currentPage}
    }).then(function (res) {
        for(var i=0;i<res.data.data.length;i++){
            var imgString=res.data.data[i].productImg;
            var imgarray=imgString.split(',');
            res.data.data[i].productImg=imgarray;
        }
        $scope.productList=res.data.data;
        $scope.totalPage=res.data.totalpage;
    });
}]);
app.controller('list1.ctrl',['$scope', '$http', '$state', function ($scope, $http, $state) {
    $scope.currentPage=1;
    $scope.goPrev=function () {
        if ($scope.currentPage==1){
            $scope.currentPage=1
        }else{
            $scope.currentPage-=1;
        }
        $http({
            url:'/product/getproductsbystyle',
            method:'get',
            params:{currentPage:$scope.currentPage,productStyle:'纯色'}
        }).then(function (res) {
            for(var i=0;i<res.data.data.length;i++){
                var imgString=res.data.data[i].productImg;
                var imgarray=imgString.split(',');
                res.data.data[i].productImg=imgarray;
            }
            $scope.productList=res.data.data;
        })
    };
    $scope.goNext=function () {
        if ($scope.currentPage==$scope.totalPage){
            $scope.currentPage=$scope.totalPage
        }else{
            $scope.currentPage+=1;
        }
        $http({
            url:'/product/getproductsbystyle',
            method:'get',
            params:{currentPage:$scope.currentPage,productStyle:'纯色'}
        }).then(function (res) {
            for(var i=0;i<res.data.data.length;i++){
                var imgString=res.data.data[i].productImg;
                var imgarray=imgString.split(',');
                res.data.data[i].productImg=imgarray;
            }
            $scope.productList=res.data.data;
        })
    };
    $http({
        url:'/product/getproductsbystyle',
        method:'get',
        params:{currentPage:$scope.currentPage,productStyle:'纯色'}
    }).then(function (res) {
        for(var i=0;i<res.data.data.length;i++){
            var imgString=res.data.data[i].productImg;
            var imgarray=imgString.split(',');
            res.data.data[i].productImg=imgarray;
        }
        $scope.productList=res.data.data;
        $scope.totalPage=res.data.totalpage;
    })
}]);
app.controller('list2.ctrl',['$scope', '$http', '$state', function ($scope, $http, $state) {
    $scope.currentPage=1;
    $scope.goPrev=function () {
        if ($scope.currentPage==1){
            $scope.currentPage=1
        }else{
            $scope.currentPage-=1;
        }
        $http({
            url:'/product/getproductsbystyle',
            method:'get',
            params:{currentPage:$scope.currentPage,productStyle:'印花'}
        }).then(function (res) {
            for(var i=0;i<res.data.data.length;i++){
                var imgString=res.data.data[i].productImg;
                var imgarray=imgString.split(',');
                res.data.data[i].productImg=imgarray;
            }
            $scope.productList=res.data.data;
        })
    };
    $scope.goNext=function () {
        if ($scope.currentPage==$scope.totalPage){
            $scope.currentPage=$scope.totalPage
        }else{
            $scope.currentPage+=1;
        }
        $http({
            url:'/product/getproductsbystyle',
            method:'get',
            params:{currentPage:$scope.currentPage,productStyle:'印花'}
        }).then(function (res) {
            for(var i=0;i<res.data.data.length;i++){
                var imgString=res.data.data[i].productImg;
                var imgarray=imgString.split(',');
                res.data.data[i].productImg=imgarray;
            }
            $scope.productList=res.data.data;
        })
    };
    $http({
        url:'/product/getproductsbystyle',
        method:'get',
        params:{currentPage:$scope.currentPage,productStyle:'印花'}
    }).then(function (res) {
        for(var i=0;i<res.data.data.length;i++){
            var imgString=res.data.data[i].productImg;
            var imgarray=imgString.split(',');
            res.data.data[i].productImg=imgarray;
        }
        $scope.productList=res.data.data;
        $scope.totalPage=res.data.totalpage;
    })
}]);
app.controller('list3.ctrl',['$scope', '$http', '$state', function ($scope, $http, $state) {
    $scope.currentPage=1;
    $scope.goPrev=function () {
        if ($scope.currentPage==1){
            $scope.currentPage=1
        }else{
            $scope.currentPage-=1;
        }
        $http({
            url:'/product/getproductsbystyle',
            method:'get',
            params:{currentPage:$scope.currentPage,productStyle:'正装修身'}
        }).then(function (res) {
            for(var i=0;i<res.data.data.length;i++){
                var imgString=res.data.data[i].productImg;
                var imgarray=imgString.split(',');
                res.data.data[i].productImg=imgarray;
            }
            $scope.productList=res.data.data;
        })
    };
    $scope.goNext=function () {
        if ($scope.currentPage==$scope.totalPage){
            $scope.currentPage=$scope.totalPage
        }else{
            $scope.currentPage+=1;
        }
        $http({
            url:'/product/getproductsbystyle',
            method:'get',
            params:{currentPage:$scope.currentPage,productStyle:'正装修身'}
        }).then(function (res) {
            for(var i=0;i<res.data.data.length;i++){
                var imgString=res.data.data[i].productImg;
                var imgarray=imgString.split(',');
                res.data.data[i].productImg=imgarray;
            }
            $scope.productList=res.data.data;
        })
    };
    $http({
        url:'/product/getproductsbystyle',
        method:'get',
        params:{currentPage:$scope.currentPage,productStyle:'正装修身'}
    }).then(function (res) {
        for(var i=0;i<res.data.data.length;i++){
            var imgString=res.data.data[i].productImg;
            var imgarray=imgString.split(',');
            res.data.data[i].productImg=imgarray;
        }
        $scope.productList=res.data.data;
        $scope.totalPage=res.data.totalpage;
    })
}]);
app.controller('list4.ctrl',['$scope', '$http', '$state', function ($scope, $http, $state) {
    $scope.currentPage=1;
    $scope.goPrev=function () {
        if ($scope.currentPage==1){
            $scope.currentPage=1
        }else{
            $scope.currentPage-=1;
        }
        $http({
            url:'/product/getproductsbystyle',
            method:'get',
            params:{currentPage:$scope.currentPage,productStyle:'衬衫'}
        }).then(function (res) {
            for(var i=0;i<res.data.data.length;i++){
                var imgString=res.data.data[i].productImg;
                var imgarray=imgString.split(',');
                res.data.data[i].productImg=imgarray;
            }
            $scope.productList=res.data.data;
        })
    };
    $scope.goNext=function () {
        if ($scope.currentPage==$scope.totalPage){
            $scope.currentPage=$scope.totalPage
        }else{
            $scope.currentPage+=1;
        }
        $http({
            url:'/product/getproductsbystyle',
            method:'get',
            params:{currentPage:$scope.currentPage,productStyle:'衬衫'}
        }).then(function (res) {
            for(var i=0;i<res.data.data.length;i++){
                var imgString=res.data.data[i].productImg;
                var imgarray=imgString.split(',');
                res.data.data[i].productImg=imgarray;
            }
            $scope.productList=res.data.data;
        })
    };
    $http({
        url:'/product/getproductsbystyle',
        method:'get',
        params:{currentPage:$scope.currentPage,productStyle:'衬衫'}
    }).then(function (res) {
        for(var i=0;i<res.data.data.length;i++){
            var imgString=res.data.data[i].productImg;
            var imgarray=imgString.split(',');
            res.data.data[i].productImg=imgarray;
        }
        $scope.productList=res.data.data;
        $scope.totalPage=res.data.totalpage;
    })
}]);